﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    public class DeviceMeasureInfo : DatamodelEntity, IDeviceMeasure
    {
        #region Fields
        private int _id;
        private string _name;
        private double _density = 0;
        private double _temperature = 0;
        private double _humidity = 0;
        private bool _isOpen = true;
        private string _tester;
        private DateTime _testtime = DateTime.Now;
        private int _messageId = 0;
        #endregion

        #region Properties
        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }
        public string Name
        {
            get { return _name; }
            set
            {
                _name = value;
                RaisePropertyChanged(() => Name);
            }
        }
        public double Density
        {
            get { return _density; }
            set
            {
                _density = value;
                RaisePropertyChanged(() => Density);
            }
        }
        public double Temperature
        {
            get { return _temperature; }
            set
            {
                _temperature = value;
                RaisePropertyChanged(() => Temperature);
            }
        }
        public double Humidity
        {
            get { return _humidity; }
            set
            {
                _humidity = value;
                RaisePropertyChanged(() => Humidity);
            }
        }
        public bool IsOpen
        {
            get { return _isOpen; }
            set
            {
                _isOpen = value;
                RaisePropertyChanged(() => IsOpen);
            }
        }
        public string Tester
        {
            get { return _tester; }
            set
            {
                _tester = value;
                RaisePropertyChanged(() => Tester);
            }
        }
        public DateTime TestTime
        {
            get { return _testtime; }
            set
            {
                _testtime = value;
                RaisePropertyChanged(() => TestTime);
            }
        }
        public int MessageId
        {
            get { return _messageId; }
            set
            {
                _messageId = value;
                RaisePropertyChanged(() => MessageId);
            }
        }
        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("Name");
            yield return new DatabaseColumn("Density");
            yield return new DatabaseColumn("Temperature");
            yield return new DatabaseColumn("Humidity");
            yield return new DatabaseColumn("IsOpen");
            yield return new DatabaseColumn("Tester");
            yield return new DatabaseColumn("TestTime");
            yield return new DatabaseColumn("MessageId");
        }
    }
}